home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / AIncludes / Events.a < prev    next >
Text File  |  1996-05-01  |  9KB  |  375 lines

  1. ;
  2. ;    File:        Events.a
  3. ;
  4. ;    Contains:    Event Manager Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 8
  7. ;                Release:    Universal Interfaces 3.0d3 on Copland DR1
  8. ;
  9. ;    Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10. ;
  11. ;    Bugs?:        If you find a problem with this file, send the file and version
  12. ;                information (from above) and the problem description to:
  13. ;
  14. ;                    Internet:    apple.bugs@applelink.apple.com
  15. ;                    AppleLink:    APPLE.BUGS
  16. ;
  17. ;
  18.     IF &TYPE('__EVENTS__') = 'UNDEFINED' THEN
  19. __EVENTS__ SET 1
  20.  
  21.     IF &TYPE('__OSUTILS__') = 'UNDEFINED' THEN
  22.     include 'OSUtils.a'
  23.     ENDIF
  24.     IF &TYPE('__QUICKDRAW__') = 'UNDEFINED' THEN
  25.     include 'Quickdraw.a'
  26.     ENDIF
  27.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  28.     include 'Types.a'
  29.     ENDIF
  30. ; typedef UInt16                         EventKind
  31.  
  32. ; typedef UInt16                         EventMask
  33.  
  34.  
  35. nullEvent                        EQU        0
  36. mouseDown                        EQU        1
  37. mouseUp                            EQU        2
  38. keyDown                            EQU        3
  39. keyUp                            EQU        4
  40. autoKey                            EQU        5
  41. updateEvt                        EQU        6
  42. diskEvt                            EQU        7
  43. activateEvt                        EQU        8
  44. osEvt                            EQU        15
  45. kHighLevelEvent                    EQU        23
  46. mDownMask                        EQU        $02                    ; mouse button pressed
  47. mUpMask                            EQU        $04                    ; mouse button released
  48. keyDownMask                        EQU        $08                    ; key pressed
  49. keyUpMask                        EQU        $10                    ; key released
  50. autoKeyMask                        EQU        $20                    ; key repeatedly held down
  51. updateMask                        EQU        $40                    ; window needs updating
  52. diskMask                        EQU        $80                    ; disk inserted
  53. activMask                        EQU        $0100                ; activate/deactivate window
  54. highLevelEventMask                EQU        $0400                ; high-level events (includes AppleEvents)
  55. osMask                            EQU        $8000                ; operating system events (suspend, resume)
  56. everyEvent                        EQU        $FFFF                ; all of the above
  57.  
  58. charCodeMask                    EQU        $000000FF
  59. keyCodeMask                        EQU        $0000FF00
  60. adbAddrMask                        EQU        $00FF0000
  61. osEvtMessageMask                EQU        $FF000000            ; OS event messages.  Event (sub)code is in the high byte of the message field.
  62. mouseMovedMessage                EQU        $00FA
  63. suspendResumeMessage            EQU        $0001
  64. resumeFlag                        EQU        1                    ; Bit 0 of message indicates resume vs suspend
  65. convertClipboardFlag            EQU        2                    ; Bit 1 in resume message indicates clipboard change
  66. ; typedef UInt16                         EventModifiers
  67.  
  68.  
  69.                                                             ; modifiers 
  70. activeFlagBit                    EQU        0                    ; activate? (activateEvt and mouseDown)
  71. btnStateBit                        EQU        7                    ; state of button?
  72. cmdKeyBit                        EQU        8                    ; command key down?
  73. shiftKeyBit                        EQU        9                    ; shift key down?
  74. alphaLockBit                    EQU        10                    ; alpha lock down?
  75. optionKeyBit                    EQU        11                    ; option key down?
  76. controlKeyBit                    EQU        12                    ; control key down?
  77. rightShiftKeyBit                EQU        13                    ; right shift key down?
  78. rightOptionKeyBit                EQU        14                    ; right Option key down?
  79. rightControlKeyBit                EQU        15                    ; right Control key down?
  80. activeFlag                        EQU        $01
  81. btnState                        EQU        $80
  82. cmdKey                            EQU        $0100
  83. shiftKey                        EQU        $0200
  84. alphaLock                        EQU        $0400
  85. optionKey                        EQU        $0800
  86. controlKey                        EQU        $1000
  87. rightShiftKey                    EQU        $2000
  88. rightOptionKey                    EQU        $4000
  89. rightControlKey                    EQU        $8000
  90.  
  91. kNullCharCode                    EQU        0
  92. kHomeCharCode                    EQU        1
  93. kEnterCharCode                    EQU        3
  94. kEndCharCode                    EQU        4
  95. kHelpCharCode                    EQU        5
  96. kBellCharCode                    EQU        7
  97. kBackspaceCharCode                EQU        8
  98. kTabCharCode                    EQU        9
  99. kLineFeedCharCode                EQU        10
  100. kVerticalTabCharCode            EQU        11
  101. kPageUpCharCode                    EQU        11
  102. kFormFeedCharCode                EQU        12
  103. kPageDownCharCode                EQU        12
  104. kReturnCharCode                    EQU        13
  105. kFunctionKeyCharCode            EQU        16
  106. kEscapeCharCode                    EQU        27
  107. kClearCharCode                    EQU        27
  108. kLeftArrowCharCode                EQU        28
  109. kRightArrowCharCode                EQU        29
  110. kUpArrowCharCode                EQU        30
  111. kDownArrowCharCode                EQU        31
  112. kDeleteCharCode                    EQU        127
  113. kNonBreakingSpaceCharCode        EQU        202
  114. EventRecord                RECORD 0
  115. what                     ds.w    1                ; offset: $0 (0)
  116. message                     ds.l    1                ; offset: $2 (2)
  117. when                     ds.l    1                ; offset: $6 (6)
  118. where                     ds        Point            ; offset: $A (10)
  119. modifiers                 ds.w    1                ; offset: $E (14)
  120. sizeof                     EQU *                    ; size:   $10 (16)
  121.                         ENDR
  122. KeyMap                    RECORD 0
  123. map                         ds.b    16                ; offset: $0 (0)
  124. sizeof                     EQU *                    ; size:   $10 (16)
  125.                         ENDR
  126.     IF FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE THEN
  127. ;
  128. ; pascal void GetMouse(Point *mouseLoc)
  129. ;
  130.     IF ¨ GENERATINGCFM THEN
  131.         _GetMouse:    OPWORD    $A972
  132.     ELSE
  133.         IMPORT_CFM_FUNCTION GetMouse
  134.     ENDIF
  135.  
  136. ;
  137. ; pascal Boolean Button(void )
  138. ;
  139.     IF ¨ GENERATINGCFM THEN
  140.         _Button:    OPWORD    $A974
  141.     ELSE
  142.         IMPORT_CFM_FUNCTION Button
  143.     ENDIF
  144.  
  145. ;
  146. ; pascal Boolean StillDown(void )
  147. ;
  148.     IF ¨ GENERATINGCFM THEN
  149.         _StillDown:    OPWORD    $A973
  150.     ELSE
  151.         IMPORT_CFM_FUNCTION StillDown
  152.     ENDIF
  153.  
  154. ;
  155. ; pascal Boolean WaitMouseUp(void )
  156. ;
  157.     IF ¨ GENERATINGCFM THEN
  158.         _WaitMouseUp:    OPWORD    $A977
  159.     ELSE
  160.         IMPORT_CFM_FUNCTION WaitMouseUp
  161.     ENDIF
  162.  
  163. ;
  164. ; pascal UInt32 TickCount(void )
  165. ;
  166.     IF ¨ GENERATINGCFM THEN
  167.         _TickCount:    OPWORD    $A975
  168.     ELSE
  169.         IMPORT_CFM_FUNCTION TickCount
  170.     ENDIF
  171.  
  172. ;
  173. ; pascal void GetKeys(KeyMap theKeys)
  174. ;
  175.     IF ¨ GENERATINGCFM THEN
  176.         _GetKeys:    OPWORD    $A976
  177.     ELSE
  178.         IMPORT_CFM_FUNCTION GetKeys
  179.     ENDIF
  180.  
  181. ;
  182. ; pascal UInt32 KeyTranslate(const void *transData, UInt16 keycode, UInt32 *state)
  183. ;
  184.     IF ¨ GENERATINGCFM THEN
  185.         _KeyTranslate:    OPWORD    $A9C3
  186.     ELSE
  187.         IMPORT_CFM_FUNCTION KeyTranslate
  188.     ENDIF
  189.  
  190. ;
  191. ; pascal UInt32 GetCaretTime(void)
  192. ;
  193.     IF ¨ GENERATINGCFM THEN
  194.         Macro
  195.         _GetCaretTime         &dest=(sp)
  196.             move.l            $02F4,&dest
  197.         EndM
  198.     ELSE
  199.         IMPORT_CFM_FUNCTION GetCaretTime
  200.     ENDIF
  201.  
  202.     ENDIF
  203.     IF FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED THEN
  204. ;  Obsolete event types & masks 
  205.  
  206. networkEvt                        EQU        10
  207. driverEvt                        EQU        11
  208. app1Evt                            EQU        12
  209. app2Evt                            EQU        13
  210. app3Evt                            EQU        14
  211. app4Evt                            EQU        15
  212. networkMask                        EQU        $0400
  213. driverMask                        EQU        $0800
  214. app1Mask                        EQU        $1000
  215. app2Mask                        EQU        $2000
  216. app3Mask                        EQU        $4000
  217. app4Mask                        EQU        $8000
  218. EvQEl                    RECORD 0
  219. qLink                     ds.l    1                ; offset: $0 (0)
  220. qType                     ds.w    1                ; offset: $4 (4)
  221. evtQWhat                 ds.w    1                ; offset: $6 (6)        ;  this part is identical to the EventRecord as defined above 
  222. evtQMessage                 ds.l    1                ; offset: $8 (8)
  223. evtQWhen                 ds.l    1                ; offset: $C (12)
  224. evtQWhere                 ds        Point            ; offset: $10 (16)
  225. evtQModifiers             ds.w    1                ; offset: $14 (20)
  226. sizeof                     EQU *                    ; size:   $16 (22)
  227.                         ENDR
  228. ; typedef struct EvQEl *                EvQElPtr
  229.  
  230. ; typedef GetNextEventFilterUPP         GNEFilterUPP
  231.  
  232. ;
  233. ; pascal QHdrPtr GetEvQHdr(void )
  234. ;
  235.     IF ¨ GENERATINGCFM THEN
  236.         Macro
  237.         _GetEvQHdr            &dest=(sp)
  238.             move.l            #$0000014A,&dest
  239.         EndM
  240.     ELSE
  241.         IMPORT_CFM_FUNCTION GetEvQHdr
  242.     ENDIF
  243.  
  244. ;
  245. ; pascal UInt32 GetDblTime(void)
  246. ;
  247.     IF ¨ GENERATINGCFM THEN
  248.         Macro
  249.         _GetDblTime           &dest=(sp)
  250.             move.l            $02F0,&dest
  251.         EndM
  252.     ELSE
  253.         IMPORT_CFM_FUNCTION GetDblTime
  254.     ENDIF
  255.  
  256. ;
  257. ; pascal void SetEventMask(EventMask value)
  258. ;
  259.     IF ¨ GENERATINGCFM THEN
  260.         Macro
  261.         _SetEventMask         &src=(sp)+
  262.             move.w            &src,$0144
  263.         EndM
  264.     ELSE
  265.         IMPORT_CFM_FUNCTION SetEventMask
  266.     ENDIF
  267.  
  268. ;
  269. ; pascal OSErr PPostEvent(EventKind eventCode, UInt32 eventMsg, EvQElPtr *qEl)
  270. ;
  271.     IF ¨ GENERATINGCFM THEN
  272.         _PPostEvent:    OPWORD    $A12F
  273.     ELSE
  274.         IMPORT_CFM_FUNCTION PPostEvent
  275.     ENDIF
  276.  
  277. ;
  278. ; pascal Boolean GetNextEvent(EventMask eventMask, EventRecord *theEvent)
  279. ;
  280.     IF ¨ GENERATINGCFM THEN
  281.         _GetNextEvent:    OPWORD    $A970
  282.     ELSE
  283.         IMPORT_CFM_FUNCTION GetNextEvent
  284.     ENDIF
  285.  
  286. ;
  287. ; pascal Boolean WaitNextEvent(EventMask eventMask, EventRecord *theEvent, UInt32 sleep, RgnHandle mouseRgn)
  288. ;
  289.     IF ¨ GENERATINGCFM THEN
  290.         _WaitNextEvent:    OPWORD    $A860
  291.     ELSE
  292.         IMPORT_CFM_FUNCTION WaitNextEvent
  293.     ENDIF
  294.  
  295. ;
  296. ; pascal Boolean EventAvail(EventMask eventMask, EventRecord *theEvent)
  297. ;
  298.     IF ¨ GENERATINGCFM THEN
  299.         _EventAvail:    OPWORD    $A971
  300.     ELSE
  301.         IMPORT_CFM_FUNCTION EventAvail
  302.     ENDIF
  303.  
  304. ;
  305. ; pascal OSErr PostEvent(EventKind eventNum, UInt32 eventMsg)
  306. ;
  307.     IF ¨ GENERATINGCFM THEN
  308.         ; parameters:
  309.         ;    eventNum        => A0
  310.         ;    eventMsg        => D0
  311.         ; returns:
  312.         ;    OSErr           <= D0
  313.         _PostEvent:    OPWORD    $A02F
  314.     ELSE
  315.         IMPORT_CFM_FUNCTION PostEvent
  316.     ENDIF
  317.  
  318. ;
  319. ; pascal Boolean OSEventAvail(EventMask mask, EventRecord *theEvent)
  320. ;
  321.     IF ¨ GENERATINGCFM THEN
  322.         _OSEventAvail:    OPWORD    $A030
  323.     ELSE
  324.         IMPORT_CFM_FUNCTION OSEventAvail
  325.     ENDIF
  326.  
  327. ;
  328. ; pascal Boolean GetOSEvent(EventMask mask, EventRecord *theEvent)
  329. ;
  330.     IF ¨ GENERATINGCFM THEN
  331.         _GetOSEvent:    OPWORD    $A031
  332.     ELSE
  333.         IMPORT_CFM_FUNCTION GetOSEvent
  334.     ENDIF
  335.  
  336. ;
  337. ; pascal void FlushEvents(EventMask whichMask, EventMask stopMask)
  338. ;
  339.     IF ¨ GENERATINGCFM THEN
  340.         _FlushEvents:    OPWORD    $A032
  341.     ELSE
  342.         IMPORT_CFM_FUNCTION FlushEvents
  343.     ENDIF
  344.  
  345. ;
  346. ; pascal void SystemClick(const EventRecord *theEvent, WindowRef theWindow)
  347. ;
  348.     IF ¨ GENERATINGCFM THEN
  349.         _SystemClick:    OPWORD    $A9B3
  350.     ELSE
  351.         IMPORT_CFM_FUNCTION SystemClick
  352.     ENDIF
  353.  
  354. ;
  355. ; pascal void SystemTask(void )
  356. ;
  357.     IF ¨ GENERATINGCFM THEN
  358.         _SystemTask:    OPWORD    $A9B4
  359.     ELSE
  360.         IMPORT_CFM_FUNCTION SystemTask
  361.     ENDIF
  362.  
  363. ;
  364. ; pascal Boolean SystemEvent(const EventRecord *theEvent)
  365. ;
  366.     IF ¨ GENERATINGCFM THEN
  367.         _SystemEvent:    OPWORD    $A9B2
  368.     ELSE
  369.         IMPORT_CFM_FUNCTION SystemEvent
  370.     ENDIF
  371.  
  372.     ENDIF
  373.     ENDIF ; __EVENTS__ 
  374.  
  375.